package controller;

import common.Result;
import domain.OrderInfo;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;

public class orderController {
    @RestController  //@RestController=@Controller+@ResponseBody
    @RequestMapping("orderinfo")
    public class  OrderController{

        /**
         * 根据id查询订单
         */
        @GetMapping("/order/{id}")
        public Result getById(@PathVariable("id") String id){
            //查询数据库
        return  Result.ok( "查询成功","200");
        }

        /**
 * 新增订单
 */

        @GetMapping ("/orders")
        public  Object  addOrder(@RequestBody OrderInfo orderInfo){
            System.out.println(orderInfo.getName());
            //tood 查询数据库
            HashMap map =  new HashMap();
            map.put ("message",orderInfo);
            return  map; //请求转发

        }

    }


}
